package com.jt.mapper;

import com.jt.pojo.ItemCat;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import java.util.List;

public interface ItemCatMapper {

    @Select("select * from item_cat where parent_id=#{parentId}")
    List<ItemCat> findItemCatByParentId(int parentId);

    @Select("select * from item_cat")
    List<ItemCat> findItemCarList();

    @Update("update item_cat set status=#{status},updated=#{updated}" +
            "where id=#{id}")
    void updateStatus(ItemCat itemCat);

    void saveItemCat(ItemCat itemCat);

    @Update("update item_cat set name=#{name},updated=#{updated} " +
            "where id=#{id}")
    void updateItemCat(ItemCat itemCat);

    @Delete("delete from item_cat where id=#{id}")
    void deleteItemCat3(Integer id);
    @Delete("delete from item_cat where id={id} or parent_id={id}")
    void deleteItemCat2(Integer id);

    void deleteItemCat1(Integer id);
}
